// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------

import request from '@/utils/request'
import fileRequest from '@/utils/file'

export function personList(params) {
  //此处直接使用参数
  return request({
    url: '/person/getPersonList',
    method: 'GET',
    params
  })
}

export function personAdd(data) {
  /*const data = {
    name: pram.name,
    gender: pram.gender,
    birthday: pram.birthday,
    faceUrl: pram.faceUrl,
    nation: pram.nation,
    nativePlace: pram.nativePlace,
    birthPlace: pram.birthPlace,
    zzmm: pram.zzmm,
    rdTime: pram.rdTime,
    joinWorkTime: pram.joinWorkTime,
    isHealth: pram.isHealth,
    education: pram.education,
    major: pram.major,
    school: pram.school,
    personType: pram.personType,
    rwTime: pram.rwTime,
    positionLevel: pram.positionLevel,
    positionTec: pram.positionTec,
    rankTitle: pram.rankTitle,
    phone: pram.phone,
    idcard: pram.idcard,
    address: pram.address,
    positionDesc: pram.positionDesc,
    positionList: pram.positionList,
    resumeList:pram.resumeList,
  }*/
  return request({
    url: '/person/insertPerson',
    method: 'POST',
    data: data
  })
}

export function personUpdate(data) {
  return request({
    url: '/person/insertPerson',
    method: 'POST',
    data
  })
}

export function personUpdateSort(pram,pram1) {
  const data = {
    ids: pram,
    sorts: pram1
  }
  return request({
    url: '/person/updatePersonSort',
    method: 'POST',
    data: data
  })
}

export function personExportExcel(data) {
  return fileRequest({
    url: '/excel/exportExcel',
    method: 'POST',
    data: data,
    responseType:'blob'
  })
}
export function personExportRoster(data) {
  return fileRequest({
    url: '/person/getPlaceByCusExcel',
    method: 'POST',
    data: data,
    responseType:'blob'
  })
}

export function personDel(pram) {
  const data = {
    id: pram.id,
  }
  return request({
    url: '/person/updatePersonStatus',
    method: 'GET',
    params : data
  })
}

export function personTrainList(params) {
  //此处直接使用参数
  return request({
    url: '/train/getTrainList',
    method: 'GET',
    params
  })
}

export function trainAdd(data) {
  return request({
    url: '/train/insertTrain',
    method: 'POST',
    data: data
  })
}

export function personEnjoyList(params) {
  //此处直接使用参数
  return request({
    url: '/enjoy/getEnjoyList',
    method: 'GET',
    params
  })
}

export function enjoyAdd(data) {
  return request({
    url: '/enjoy/insertEnjoy',
    method: 'POST',
    data: data
  })
}
export function applyTypeApi(params) {
  //此处直接使用参数
  return request({
    url: '/applyType',
    method: 'GET',
    params
  })
}

/**
 * 文件导入
 * @param data
 */
export function doImport(data) {
  return request({
    url: '/import/importPerson',
    method: 'POST',
    data
  })
}

/**
 * 文件导入
 * @param data
 */
export function doImportList(data) {
  return request({
    url: '/import/importPersonList',
    method: 'POST',
    data
  })
}

/**
 * 弹药检测数量统计导出
 * @param data
 * @returns {*}
 */
export function exportRoster(data) {
  return fileRequest({
    url: '/excel/trainExcel',
    method: 'POST',
    data: data,
    responseType:'blob'
  })
}

export function getDepartmentList() {
  return request({
    url: '/dep/selectDep',
    method: 'GET',
  })
}




//批量删除的方法
export function typeDelBatchPerson(params) {
  return request({
    url: '/person/deletePersonBatchByIds',
    method: 'DELETE',
    params,
  });
}
